package com.igogogo.web;


import com.baomidou.mybatisplus.plugins.Page;
import com.igogogo.entity.Accounts;
import com.igogogo.service.IAccountsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Mr.Chen
 * @since 2018-07-01
 */
@RestController
@RequestMapping("/accounts")
public class AccountsController {
    @Autowired
    private IAccountsService iAccountsService;

    @GetMapping(value = "{id}")
    public Accounts findById(@PathVariable int id) {
        return iAccountsService.selectById(id);
    }

    @GetMapping(value = "{currentPage}/{size}")
    public Page<Accounts> selectPage(@PathVariable Integer currentPage, @PathVariable Integer size) {
        Page<Accounts> page = new Page(currentPage, size);
        return iAccountsService.selectPage(page);
    }
}

